From 274075f331f0f68bcac49d07422bb5098b3436c5 Mon Sep 17 00:00:00 2001 From: Andres Lagar-Cavilla Date: Wed, 18 Apr 2012 13:38:47 +0100 Subject: [PATCH] x86/mm: Fix locking on hap enable failure If enabling hap fails due to out of memory, the locking on the clean up path is broken. Signed-off-by: Andres Lagar-Cavilla Acked-by: Tim Deegan Committed-by: Tim Deegan --- xen/arch/x86/mm/hap/hap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/mm/hap/hap.c b/xen/arch/x86/mm/hap/hap.c index 4ad21db59b..13b4be211a 100644 --- a/xen/arch/x86/mm/hap/hap.c +++ b/xen/arch/x86/mm/hap/hap.c @@ -585,13 +585,14 @@ int hap_enable(struct domain *d, u32 mode) unsigned int r; paging_lock(d); r = hap_set_allocation(d, 256, NULL); - paging_unlock(d); if ( r != 0 ) { hap_set_allocation(d, 0, NULL); + paging_unlock(d); rv = -ENOMEM; goto out; } + paging_unlock(d); } /* Allow p2m and log-dirty code to borrow our memory */ -- 2.30.2